

public class Demo5<T> {

    private T data;


    //判断是整数还是小数
    public void test(T data){
        if (data instanceof Integer){
            System.out.println("整数");
        }else if (data instanceof Double){
            System.out.println("小数");
        }else {
            System.out.println("其他");
        }
    }

    public static void main(String[] args) {
        new Demo5().test(10.0);
    }


}
